home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 7439 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  70 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: news.duc.auburn.edu!usenet
  3. From: beckwwp@unconfigured.xvnews.domain (Wendell P. Beckwith)
  4. Subject: Re: C++ Classes
  5. Message-ID: <DpysnI.Ctq@mail.auburn.edu>
  6. Sender: usenet@mail.auburn.edu (Usenet Administrator)
  7. Nntp-Posting-Host: wartan.eng.auburn.edu
  8. Reply-To: beckwwp@unconfigured.xvnews.domain
  9. Organization: The unconfigured xvnews people
  10. References: <Stewart_Menday.3jrp@kumear.DIALix.oz.au>
  11. Date: Tue, 16 Apr 1996 17:02:05 GMT
  12.  
  13. In article <Stewart_Menday.3jrp@kumear.DIALix.oz.au>, Stewart_Menday@kumear.DIALix.oz.au (Stewart Menday) writes:
  14. >Hi ALL
  15. >     I have a question about C++ and calling functions which have been
  16. >overriden.
  17. >
  18. >If I have a class x say and it is derived from class y say and they both a
  19. >method print() say.  How do I call class y print from within class x?
  20. >
  21. >e.g.
  22. >
  23. >y.h
  24. >
  25. >class y{
  26. >public:
  27. >     void print();
  28. >     \
  29. >     /
  30. >     \
  31. >     /
  32. >
  33. >}
  34. >
  35. >x.h
  36. >
  37. >class x:public y{
  38. >public:
  39. >     void print();   
  40. >     \
  41. >     /
  42. >     \
  43. >     /
  44. >}
  45. >
  46. >x.cc
  47. >
  48. >void x::print();
  49. >{
  50. >     //some stuff for x
  51. >
  52. >     //I wish to call y.print
  53. >}
  54. >
  55. >Any help would be great.
  56. >
  57. >
  58. >Stew
  59. >
  60. >-- Via DLG Pro v1.1
  61. >
  62.  
  63. You would call it this way:
  64.  
  65. void x::print() {
  66.     y::print();
  67. }
  68.  
  69.  
  70.